package com.lin.videospringboot.service;


import com.lin.videospringboot.been.PostComment;
import com.lin.videospringboot.mapper.PostCommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PostCommentServiceImpl {

    @Autowired
    PostCommentMapper postCommentMapper;


    public int addPostComment(PostComment postComment) {
        return postCommentMapper.insert(postComment);
    }

    public int updatePostCommentById(PostComment postComment) {
        return postCommentMapper.updateById(postComment);
    }

    public int addGoodsById(int postCommentId) {
        PostComment postComment = postCommentMapper.selectById(postCommentId);
        postComment.setLikes(postComment.getLikes()+1);
        return postCommentMapper.updateById(postComment);
    }
}
